package com.weds.edpf.core .web;

import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.ArrayList;
import java.util.List;
import java.util.Date;
import javax.validation.Valid;

import com.weds.core.base.BaseController;
import com.weds.core.annotation.Logs;
import com.weds.core.resp.JsonResult;
import com.weds.core.base.BaseCommPager;
import com.weds.core.base.BasePageSearch;


import com.weds.edpf.core.entity .KqVerEntity;
import com.weds.edpf.core.service .KqVerService;

/**
 * @Author sxm
 * @Description KqVer管理
 * @Date 2020-06-15
 */
@RestController
@RequestMapping(value="/kqVer")
@Api(value = "KqVer管理", description = "KqVer管理")
public class KqVerController extends BaseController{
	@Autowired
	private KqVerService kqVerService;

    
	private Logger log = LogManager.getLogger();

    @Logs
	@ApiOperation(value = "新增KqVer信息", notes = "新增KqVer信息")
	@RequestMapping(value = "/insert", method = RequestMethod.PUT)
	public JsonResult<Object> insert(@RequestBody @Valid KqVerEntity record) {
        				kqVerService.insertSelective(record);
		return succMsg();
	}

		@Logs
	@ApiOperation(value = "查询KqVer清单", notes = "查询KqVer清单")
	@RequestMapping(value = "/selectListPageByEntity", method = RequestMethod.POST)
	public JsonResult<BaseCommPager<KqVerEntity>> selectListPageByEntity(@RequestBody BasePageSearch<KqVerEntity> record) {
		setPageHelper(record);
		KqVerEntity entity = record.getSearch();
        if (entity == null) {
        	entity = new KqVerEntity();
        }
                List<KqVerEntity> list = kqVerService.selectListByEntity(entity);
        		return succMsgData(new BaseCommPager<KqVerEntity>(list));
	}

    @Logs
    @ApiOperation(value = "查询KqVer列表", notes = "查询KqVer列表")
    @RequestMapping(value = "/selectListByEntity", method = RequestMethod.POST)
    public JsonResult<List<KqVerEntity>> selectListByEntity(@RequestBody KqVerEntity record) {
                List<KqVerEntity> list = kqVerService.selectListByEntity(record);
                return succMsgData(list);
    }


		@Logs
	@ApiOperation(value = "批量新增KqVer信息", notes = "批量新增KqVer信息")
	@RequestMapping(value = "/insertBatch", method = RequestMethod.PUT)
	public JsonResult<Object> insertBatch(@RequestParam String data) {
		List<KqVerEntity> list	= JSONObject.parseArray(data, KqVerEntity.class);
		kqVerService.insertBatch(list);
		return succMsg();
	}
	}